package com.fand.configuration.service;

import java.util.Map;

import org.springframework.cache.annotation.CacheEvict;

import com.fand.configuration.dao.DictionaryDao;
import com.fand.configuration.dto.DictionaryDeDto;
import com.fand.configuration.dto.DictionaryDto;
import com.fand.configuration.dto.DictionaryTyDto;
import com.fand.dto.PaginationDto;

/**
 * 字典服务
 * 
 * @author haitao.yao
 * 
 */
public class DefaultDictionaryService implements DictionaryService {
	private ConfigurationService configurationService;

	private DictionaryDao dictionaryDao;

	@Override
	public int deleteDictionaryDeBy1(final String entityId) {
		return this.dictionaryDao.deleteDictionaryDeBy1(entityId);
	}

	@Override
	public PaginationDto<Map<String, Object>> paginationDictionaryTyBy1ForMapList(final DictionaryTyDto dictionaryTy) {
		return this.dictionaryDao.paginationDictionaryTyBy1ForMapList(dictionaryTy);
	}

	@Override
	@CacheEvict(value = DictionaryService.CACHE_NAME, allEntries = true)
	public void reload() {
	}

	@Override
	public String saveDictionaryBy1ForObject(final DictionaryDto dictionary) {
		return this.dictionaryDao.saveDictionaryBy1ForObject(dictionary);
	}

	@Override
	public int saveDictionaryDeBy1(final DictionaryDeDto dictionaryDe) {
		return this.dictionaryDao.saveDictionaryDeBy1ForObject(dictionaryDe);
	}

	@Override
	public String saveDictionaryTyBy1ForObject(final DictionaryTyDto dictionaryTy) {
		return this.dictionaryDao.saveDictionaryTyBy1ForObject(dictionaryTy);
	}

	@Override
	public String selectDictionaryBy1ForObject(final String dictionaryTyCo, final String dictionaryCo) {
		return this.dictionaryDao.selectDictionaryBy1ForObject(dictionaryTyCo, dictionaryCo);
	}

	public void setConfigurationService(final ConfigurationService configurationService) {
		this.configurationService = configurationService;
	}

	public void setDictionaryDao(final DictionaryDao dictionaryDao) {
		this.dictionaryDao = dictionaryDao;
	}

	@Override
	public int deleteDictionaryTyByIds(String ids) {
		return this.dictionaryDao.deleteDictionaryTyByIds(ids);
	}
}